Skip to contentSkip to conversation

tensorflow: do not fail on chmod failure

PATCH In review Julien STEPHAN 3 participants 6 messages Dec 21, 2021 – Jan 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tensorflow: do not fail on chmod failure

every recipe using tensorflow.inc will inherits the do_compile:append task but sometimes, the chmod inside this task fails because the target files are not generated, we can safely ignore the chmod exit code and always return 0

---
 recipes-framework/tensorflow/tensorflow.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-framework/tensorflow/tensorflow.inc +2 -2
index e30cca5..25d2ebf 100644
@@ -39,6 +39,6 @@ TF_CONFIG ?= " \
 inherit tensorflow_ver
 
 do_compile:append() {
-    chmod a+w ${BAZEL_DIR}/output_base/execroot/org_tensorflow/bazel-out/*/bin/tensorflow/lite/python/schema_py_srcs_no_include_all
-    chmod a+w ${BAZEL_DIR}/output_base/execroot/org_tensorflow/bazel-out/*/bin/tensorflow/lite/python/schema_py_srcs_no_include_all/tflite
+    chmod a+w ${BAZEL_DIR}/output_base/execroot/org_tensorflow/bazel-out/*/bin/tensorflow/lite/python/schema_py_srcs_no_include_all || true
+    chmod a+w ${BAZEL_DIR}/output_base/execroot/org_tensorflow/bazel-out/*/bin/tensorflow/lite/python/schema_py_srcs_no_include_all/tflite || true
 }
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 bazel.class: rename BAZEL_ARGS to BAZEL_STARTUP_OPTIONS

BAZEL_ARGS variable contains bazel startup options so rename the variable to be more explicit. Moreover upstream tensorflow uses the variable name BAZEL_STARTUP_OPTIONS inside
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh#L97
so we can keep consistency with upstream and this would be useful for future tensorflow-lite recipe

---
 classes/bazel.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
classes/bazel.bbclass +2 -2
index e232d30..ccdfd74 100644
@@ -7,7 +7,7 @@ inherit bazel-base
 
 BAZEL_DIR ?= "${WORKDIR}/bazel"
 BAZEL_OUTPUTBASE_DIR ?= "${BAZEL_DIR}/output_base"
-export BAZEL_ARGS="--output_user_root=${BAZEL_DIR}/user_root \
+export BAZEL_STARTUP_OPTIONS="--output_user_root=${BAZEL_DIR}/user_root \
                    --output_base=${BAZEL_OUTPUTBASE_DIR} \
                    --bazelrc=${S}/bazelrc \
                    --batch  \
@@ -19,7 +19,7 @@ do_prepare_recipe_sysroot[postfuncs] += "do_install_bazel"
 do_install_bazel() {
     mkdir -p ${BAZEL_DIR}
     install -m 0755 ${STAGING_BINDIR_NATIVE}/bazel ${BAZEL_DIR}
-    create_cmdline_wrapper ${BAZEL} \$BAZEL_ARGS
+    create_cmdline_wrapper ${BAZEL} \$BAZEL_STARTUP_OPTIONS
     zip -A ${BAZEL}.real
 }
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 tensorflow-lite: add recipe

In reply to Julien STEPHAN

Adding 2.6.1 tensorflow-lite recipe.
This recipe is directly based on the corresponding 2.6.1 tensorflow recipe.

It has been build tested with latest honister and tested on several mediatek soc using benchmark_model and label_image (C++ and python)

---
 .../tensorflow/tensorflow-lite_2.6.1.bb       | 156 ++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100644 recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +156 -0
new file mode 100644
index 0000000..104e5a3
@@ -0,0 +1,156 @@
+include tensorflow.inc
+
+SRC_URI += " \
+           file://0001-add-yocto-toolchain-to-support-cross-compiling.patch \
+           file://0001-fix-build-tensorflow-lite-examples-label_image-label.patch \
+           file://0001-label_image-tweak-default-model-location.patch \
+           file://0001-label_image.lite-tweak-default-model-location.patch \
+           file://0001-CheckFeatureOrDie-use-warning-to-avoid-die.patch \
+           file://0001-support-32-bit-x64-and-arm-for-yocto.patch \
+           file://0001-Revert-set-distinct_host_configuration-false-by-defa.patch \
+           file://0001-fix-default-Bazel-toolchain-not-work.patch \
+           file://0001-distutils-is-deprecated-in-Python-3.10-cross.patch \
+           file://BUILD.in \
+           file://BUILD.yocto_compiler \
+           file://cc_config.bzl.tpl \
+           file://yocto_compiler_configure.bzl \
+          "
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz;name=model-inv3"
+SRC_URI[model-inv3.md5sum] = "a904ddf15593d03c7dd786d552e22d73"
+SRC_URI[model-inv3.sha256sum] = "7045b72a954af4dce36346f478610acdccbf149168fa25c78e54e32f0c723d6d"
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_1.0_224_quant_and_labels.zip;name=model-mobv1"
+SRC_URI[model-mobv1.md5sum] = "38ac0c626947875bd311ef96c8baab62"
+SRC_URI[model-mobv1.sha256sum] = "2f8054076cf655e1a73778a49bd8fd0306d32b290b7e576dda9574f00f186c0f"
+
+RDEPENDS:${PN} += " \
+    python3 \
+    python3-core \
+    python3-numpy \
+"
+
+export PYTHON_BIN_PATH="${PYTHON}"
+export PYTHON_LIB_PATH="${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages"
+
+export CROSSTOOL_PYTHON_INCLUDE_PATH="${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}"
+
+do_configure:append () {
+    if [ ! -e ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h ];then
+        mv ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h
+    fi
+
+    install -m 644 ${STAGING_INCDIR_NATIVE}/python${PYTHON_BASEVERSION}${PYTHON_ABI}/pyconfig.h \
+       ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-native.h
+
+    cat > ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h <<ENDOF
+#if defined (_PYTHON_INCLUDE_TARGET)
+#include "pyconfig-target.h"
+#elif defined (_PYTHON_INCLUDE_NATIVE)
+#include "pyconfig-native.h"
+#else
+#error "_PYTHON_INCLUDE_TARGET or _PYTHON_INCLUDE_NATIVE is not defined"
+#endif // End of #if defined (_PYTHON_INCLUDE_TARGET)
+
+ENDOF
+
+    mkdir -p ${S}/third_party/toolchains/yocto/
+    sed "s#%%CPU%%#${BAZEL_TARGET_CPU}#g" ${WORKDIR}/BUILD.in  > ${S}/third_party/toolchains/yocto/BUILD
+    chmod 644 ${S}/third_party/toolchains/yocto/BUILD
+    install -m 644 ${WORKDIR}/cc_config.bzl.tpl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/yocto_compiler_configure.bzl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/BUILD.yocto_compiler ${S}
+
+    CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    SED_COMMAND="s#%%CT_NAME%%#${CT_NAME}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%WORKDIR%%#${WORKDIR}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%YOCTO_COMPILER_PATH%%#${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler#g"
+
+    sed -i "${SED_COMMAND}" ${S}/BUILD.yocto_compiler \
+                            ${S}/WORKSPACE
+
+    ${TF_CONFIG} \
+    ./configure
+}
+
+TF_TARGET_EXTRA ??= ""
+
+export CUSTOM_BAZEL_FLAGS = " \
+    ${TF_ARGS_EXTRA} \
+    --jobs=auto \
+    -c opt \
+    --cpu=${BAZEL_TARGET_CPU} \
+    --crosstool_top=@local_config_yocto_compiler//:toolchain \
+    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
+"
+
+do_compile () {
+    export CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    unset CC
+
+    ${BAZEL} build \
+        ${CUSTOM_BAZEL_FLAGS} \
+        --copt -DTF_LITE_DISABLE_X86_NEON --copt -DMESA_EGL_NO_X11_HEADERS \
+        tensorflow/lite:libtensorflowlite.so \
+        tensorflow/lite/tools/benchmark:benchmark_model \
+        //tensorflow/lite/examples/label_image:label_image \
+        ${TF_TARGET_EXTRA}
+
+    # build pip package
+    ${S}/tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh
+
+}
+
+do_install() {
+    install -d ${D}${libdir}
+    install -m 644 ${S}/bazel-bin/tensorflow/lite/libtensorflowlite.so \
+        ${D}${libdir}
+
+    install -d ${D}${sbindir}
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model \
+        ${D}${sbindir}
+
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/examples/label_image/label_image \
+        ${D}${sbindir}/label_image
+
+    install -d ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/imagenet_slim_labels.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/inception_v3_2016_08_28_frozen.pb \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/examples/label_image/data/grace_hopper.jpg \
+        ${D}${datadir}/label_image
+
+    install -m 644 ${WORKDIR}/labels_mobilenet_quant_v1_224.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/mobilenet_v1_1.0_224_quant.tflite \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \
+        ${D}${datadir}/label_image
+
+
+    #echo "Installing pip package"
+    install -d ${D}/${PYTHON_SITEPACKAGES_DIR}
+    ${STAGING_BINDIR_NATIVE}/pip3 install --disable-pip-version-check -v \
+        -t ${D}/${PYTHON_SITEPACKAGES_DIR} --no-cache-dir --no-deps \
+        ${S}/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-${PV}-*.whl
+
+}
+
+FILES:${PN} += "${libdir} ${sbindir} ${datadir}/*"
+INSANE_SKIP:${PN} += "dev-so \
+                      already-stripped \
+                     "
+
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+ALLOW_EMPTY:${PN} = "1"
+
+FILES:${PN} += "${libdir} /home/root/*"
+
+inherit siteinfo unsupportarch
+python __anonymous() {
+    if d.getVar("SITEINFO_ENDIANNESS") == 'be':
+        msg =  "\nIt failed to use pre-build model to do predict/inference on big-endian platform"
+        msg += "\n(such as qemumips), since upstream does not support big-endian very well."
+        msg += "\nDetails: https://github.com/tensorflow/tensorflow/issues/16364"
+        bb.warn(msg)
+}
Signature · 1 line
2.34.1
#3 lore raw

Re: [yocto] [meta-tensorflow][PATCH 3/3] tensorflow-lite: add recipe

Thanks Stephan.

Hongxu, did you miss this?

../Randy

Quoted 187 lines · Julien STEPHAN

Adding 2.6.1 tensorflow-lite recipe.
This recipe is directly based on the corresponding 2.6.1 tensorflow recipe.

It has been build tested with latest honister and tested on several mediatek soc using benchmark_model and label_image (C++ and python)

---
  .../tensorflow/tensorflow-lite_2.6.1.bb       | 156 ++++++++++++++++++
  1 file changed, 156 insertions(+)

create mode 100644 recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +156 -1
new file mode 100644
index 0000000..104e5a3
@@ -0,0 +1,156 @@
+include tensorflow.inc
+
+SRC_URI += " \
+           file://0001-add-yocto-toolchain-to-support-cross-compiling.patch \
+           file://0001-fix-build-tensorflow-lite-examples-label_image-label.patch \
+           file://0001-label_image-tweak-default-model-location.patch \
+           file://0001-label_image.lite-tweak-default-model-location.patch \
+           file://0001-CheckFeatureOrDie-use-warning-to-avoid-die.patch \
+           file://0001-support-32-bit-x64-and-arm-for-yocto.patch \
+           file://0001-Revert-set-distinct_host_configuration-false-by-defa.patch \
+           file://0001-fix-default-Bazel-toolchain-not-work.patch \
+           file://0001-distutils-is-deprecated-in-Python-3.10-cross.patch \
+           file://BUILD.in \
+           file://BUILD.yocto_compiler \
+           file://cc_config.bzl.tpl \
+           file://yocto_compiler_configure.bzl \
+          "
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz;name=model-inv3"
+SRC_URI[model-inv3.md5sum] = "a904ddf15593d03c7dd786d552e22d73"
+SRC_URI[model-inv3.sha256sum] = "7045b72a954af4dce36346f478610acdccbf149168fa25c78e54e32f0c723d6d"
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_1.0_224_quant_and_labels.zip;name=model-mobv1"
+SRC_URI[model-mobv1.md5sum] = "38ac0c626947875bd311ef96c8baab62"
+SRC_URI[model-mobv1.sha256sum] = "2f8054076cf655e1a73778a49bd8fd0306d32b290b7e576dda9574f00f186c0f"
+
+RDEPENDS:${PN} += " \
+    python3 \
+    python3-core \
+    python3-numpy \
+"
+
+export PYTHON_BIN_PATH="${PYTHON}"
+export PYTHON_LIB_PATH="${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages"
+
+export CROSSTOOL_PYTHON_INCLUDE_PATH="${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}"
+
+do_configure:append () {
+    if [ ! -e ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h ];then
+        mv ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h
+    fi
+
+    install -m 644 ${STAGING_INCDIR_NATIVE}/python${PYTHON_BASEVERSION}${PYTHON_ABI}/pyconfig.h \
+       ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-native.h
+
+    cat > ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h <<ENDOF
+#if defined (_PYTHON_INCLUDE_TARGET)
+#include "pyconfig-target.h"
+#elif defined (_PYTHON_INCLUDE_NATIVE)
+#include "pyconfig-native.h"
+#else
+#error "_PYTHON_INCLUDE_TARGET or _PYTHON_INCLUDE_NATIVE is not defined"
+#endif // End of #if defined (_PYTHON_INCLUDE_TARGET)
+
+ENDOF
+
+    mkdir -p ${S}/third_party/toolchains/yocto/
+    sed "s#%%CPU%%#${BAZEL_TARGET_CPU}#g" ${WORKDIR}/BUILD.in  > ${S}/third_party/toolchains/yocto/BUILD
+    chmod 644 ${S}/third_party/toolchains/yocto/BUILD
+    install -m 644 ${WORKDIR}/cc_config.bzl.tpl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/yocto_compiler_configure.bzl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/BUILD.yocto_compiler ${S}
+
+    CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    SED_COMMAND="s#%%CT_NAME%%#${CT_NAME}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%WORKDIR%%#${WORKDIR}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%YOCTO_COMPILER_PATH%%#${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler#g"
+
+    sed -i "${SED_COMMAND}" ${S}/BUILD.yocto_compiler \
+                            ${S}/WORKSPACE
+
+    ${TF_CONFIG} \
+    ./configure
+}
+
+TF_TARGET_EXTRA ??= ""
+
+export CUSTOM_BAZEL_FLAGS = " \
+    ${TF_ARGS_EXTRA} \
+    --jobs=auto \
+    -c opt \
+    --cpu=${BAZEL_TARGET_CPU} \
+    --crosstool_top=@local_config_yocto_compiler//:toolchain \
+    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
+"
+
+do_compile () {
+    export CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    unset CC
+
+    ${BAZEL} build \
+        ${CUSTOM_BAZEL_FLAGS} \
+        --copt -DTF_LITE_DISABLE_X86_NEON --copt -DMESA_EGL_NO_X11_HEADERS \
+        tensorflow/lite:libtensorflowlite.so \
+        tensorflow/lite/tools/benchmark:benchmark_model \
+        //tensorflow/lite/examples/label_image:label_image \
+        ${TF_TARGET_EXTRA}
+
+    # build pip package
+    ${S}/tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh
+
+}
+
+do_install() {
+    install -d ${D}${libdir}
+    install -m 644 ${S}/bazel-bin/tensorflow/lite/libtensorflowlite.so \
+        ${D}${libdir}
+
+    install -d ${D}${sbindir}
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model \
+        ${D}${sbindir}
+
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/examples/label_image/label_image \
+        ${D}${sbindir}/label_image
+
+    install -d ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/imagenet_slim_labels.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/inception_v3_2016_08_28_frozen.pb \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/examples/label_image/data/grace_hopper.jpg \
+        ${D}${datadir}/label_image
+
+    install -m 644 ${WORKDIR}/labels_mobilenet_quant_v1_224.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/mobilenet_v1_1.0_224_quant.tflite \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \
+        ${D}${datadir}/label_image
+
+
+    #echo "Installing pip package"
+    install -d ${D}/${PYTHON_SITEPACKAGES_DIR}
+    ${STAGING_BINDIR_NATIVE}/pip3 install --disable-pip-version-check -v \
+        -t ${D}/${PYTHON_SITEPACKAGES_DIR} --no-cache-dir --no-deps \
+        ${S}/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-${PV}-*.whl
+
+}
+
+FILES:${PN} += "${libdir} ${sbindir} ${datadir}/*"
+INSANE_SKIP:${PN} += "dev-so \
+                      already-stripped \
+                     "
+
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+ALLOW_EMPTY:${PN} = "1"
+
+FILES:${PN} += "${libdir} /home/root/*"
+
+inherit siteinfo unsupportarch
+python __anonymous() {
+    if d.getVar("SITEINFO_ENDIANNESS") == 'be':
+        msg =  "\nIt failed to use pre-build model to do predict/inference on big-endian platform"
+        msg += "\n(such as qemumips), since upstream does not support big-endian very well."
+        msg += "\nDetails: https://github.com/tensorflow/tensorflow/issues/16364"
+        bb.warn(msg)
+}
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#55634): https://lists.yoctoproject.org/g/yocto/message/55634
Mute This Topic: https://lists.yoctoproject.org/mt/87873857/3616765
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#4 lore raw

Re: [yocto] [meta-tensorflow][PATCH 3/3] tensorflow-lite: add recipe

Hi Hongxu

Did you have a chance to take a look at it?

Best
Julien

Le ven. 24 déc. 2021 à 19:48, Randy MacLeod <[email protected]> a écrit :

Quoted 239 lines

Thanks Stephan.

Hongxu, did you miss this?

../Randy

Quoted 8 lines · Julien STEPHAN

Adding 2.6.1 tensorflow-lite recipe.
This recipe is directly based on the corresponding 2.6.1 tensorflow recipe.

It has been build tested with latest honister and tested on several mediatek soc using benchmark_model and label_image (C++ and python)

Quoted 5 lines
---
  .../tensorflow/tensorflow-lite_2.6.1.bb       | 156 ++++++++++++++++++
  1 file changed, 156 insertions(+)

create mode 100644 recipes-framework/tensorflow/

tensorflow-lite_2.6.1.bb

Review

Quoted 2 lines
(quoted diff) +0 -0

b/recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 4

Quoted 9 lines

new file mode 100644
index 0000000..104e5a3

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +4 -0
@@ -0,0 +1,156 @@
+include tensorflow.inc
+
+SRC_URI += " \
+

file://0001-add-yocto-toolchain-to-support-cross-compiling.patch \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 5

Quoted 1 line
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +1 -0
+

file://0001-fix-build-tensorflow-lite-examples-label_image-label.patch \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 7

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+           file://0001-label_image-tweak-default-model-location.patch \
+

file://0001-label_image.lite-tweak-default-model-location.patch \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 8

Quoted 1 line
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +1 -0
+           file://0001-CheckFeatureOrDie-use-warning-to-avoid-die.patch

\

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 10

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+           file://0001-support-32-bit-x64-and-arm-for-yocto.patch \
+

file://0001-Revert-set-distinct_host_configuration-false-by-defa.patch \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 12

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+           file://0001-fix-default-Bazel-toolchain-not-work.patch \
+

file://0001-distutils-is-deprecated-in-Python-3.10-cross.patch \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 7 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +7 -0
+           file://BUILD.in \
+           file://BUILD.yocto_compiler \
+           file://cc_config.bzl.tpl \
+           file://yocto_compiler_configure.bzl \
+          "
+
+SRC_URI += "

https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz;name=model-inv3
"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 21

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+SRC_URI[model-inv3.md5sum] = "a904ddf15593d03c7dd786d552e22d73"
+SRC_URI[model-inv3.sha256sum] =

"7045b72a954af4dce36346f478610acdccbf149168fa25c78e54e32f0c723d6d"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 23

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+
+SRC_URI += "

https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_1.0_224_quant_and_labels.zip;name=model-mobv1
"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 25

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+SRC_URI[model-mobv1.md5sum] = "38ac0c626947875bd311ef96c8baab62"
+SRC_URI[model-mobv1.sha256sum] =

"2f8054076cf655e1a73778a49bd8fd0306d32b290b7e576dda9574f00f186c0f"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 9 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +9 -0
+
+RDEPENDS:${PN} += " \
+    python3 \
+    python3-core \
+    python3-numpy \
+"
+
+export PYTHON_BIN_PATH="${PYTHON}"
+export

PYTHON_LIB_PATH="${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 36

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+
+export

CROSSTOOL_PYTHON_INCLUDE_PATH="${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 4 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +4 -0
+
+do_configure:append () {
+    if [ ! -e ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h ];then
+        mv ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h

${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 3 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +3 -0
+    fi
+
+    install -m 644

${STAGING_INCDIR_NATIVE}/python${PYTHON_BASEVERSION}${PYTHON_ABI}/pyconfig.h \

Quoted 5 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +5 -0
+       ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-native.h
+
+    cat > ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h <<ENDOF
+#if defined (_PYTHON_INCLUDE_TARGET)
+#include "pyconfig-target.h"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 10 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +10 -0
+#elif defined (_PYTHON_INCLUDE_NATIVE)
+#include "pyconfig-native.h"
+#else
+#error "_PYTHON_INCLUDE_TARGET or _PYTHON_INCLUDE_NATIVE is not defined"
+#endif // End of #if defined (_PYTHON_INCLUDE_TARGET)
+
+ENDOF
+
+    mkdir -p ${S}/third_party/toolchains/yocto/
+    sed "s#%%CPU%%#${BAZEL_TARGET_CPU}#g" ${WORKDIR}/BUILD.in  >

${S}/third_party/toolchains/yocto/BUILD

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 60

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+    chmod 644 ${S}/third_party/toolchains/yocto/BUILD
+    install -m 644 ${WORKDIR}/cc_config.bzl.tpl

${S}/third_party/toolchains/yocto/

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 61

Quoted 1 line
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +1 -0
+    install -m 644 ${WORKDIR}/yocto_compiler_configure.bzl

${S}/third_party/toolchains/yocto/

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 6 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +6 -0
+    install -m 644 ${WORKDIR}/BUILD.yocto_compiler ${S}
+
+    CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    SED_COMMAND="s#%%CT_NAME%%#${CT_NAME}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%WORKDIR%%#${WORKDIR}#g"
+    SED_COMMAND="${SED_COMMAND};

s#%%YOCTO_COMPILER_PATH%%#${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler#g"

Quoted 16 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +16 -0
+
+    sed -i "${SED_COMMAND}" ${S}/BUILD.yocto_compiler \
+                            ${S}/WORKSPACE
+
+    ${TF_CONFIG} \
+    ./configure
+}
+
+TF_TARGET_EXTRA ??= ""
+
+export CUSTOM_BAZEL_FLAGS = " \
+    ${TF_ARGS_EXTRA} \
+    --jobs=auto \
+    -c opt \
+    --cpu=${BAZEL_TARGET_CPU} \
+    --crosstool_top=@local_config_yocto_compiler//:toolchain \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 10 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +10 -0
+    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
+"
+
+do_compile () {
+    export CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    unset CC
+
+    ${BAZEL} build \
+        ${CUSTOM_BAZEL_FLAGS} \
+        --copt -DTF_LITE_DISABLE_X86_NEON --copt

-DMESA_EGL_NO_X11_HEADERS \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 101

Quoted 7 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +7 -0
+        tensorflow/lite:libtensorflowlite.so \
+        tensorflow/lite/tools/benchmark:benchmark_model \
+        //tensorflow/lite/examples/label_image:label_image \
+        ${TF_TARGET_EXTRA}
+
+    # build pip package
+

${S}/tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 10 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +10 -0
+
+}
+
+do_install() {
+    install -d ${D}${libdir}
+    install -m 644 ${S}/bazel-bin/tensorflow/lite/libtensorflowlite.so \
+        ${D}${libdir}
+
+    install -d ${D}${sbindir}
+    install -m 755

${S}/bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 3 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +3 -0
+        ${D}${sbindir}
+
+    install -m 755

${S}/bazel-bin/tensorflow/lite/examples/label_image/label_image \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 4 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +4 -0
+        ${D}${sbindir}/label_image
+
+    install -d ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/imagenet_slim_labels.txt

${D}${datadir}/label_image

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 3 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +3 -0
+    install -m 644 ${WORKDIR}/inception_v3_2016_08_28_frozen.pb \
+        ${D}${datadir}/label_image
+    install -m 644

${S}/tensorflow/examples/label_image/data/grace_hopper.jpg \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 3 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +3 -0
+        ${D}${datadir}/label_image
+
+    install -m 644 ${WORKDIR}/labels_mobilenet_quant_v1_224.txt

${D}${datadir}/label_image

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 3 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +3 -0
+    install -m 644 ${WORKDIR}/mobilenet_v1_1.0_224_quant.tflite \
+        ${D}${datadir}/label_image
+    install -m 644

${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 6 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +6 -0
+        ${D}${datadir}/label_image
+
+
+    #echo "Installing pip package"
+    install -d ${D}/${PYTHON_SITEPACKAGES_DIR}
+    ${STAGING_BINDIR_NATIVE}/pip3 install --disable-pip-version-check

-v \

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 134

Quoted 2 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -0
+        -t ${D}/${PYTHON_SITEPACKAGES_DIR} --no-cache-dir --no-deps \
+

${S}/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-${PV}-*.whl

Quoted 8 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +8 -0
+
+}
+
+FILES:${PN} += "${libdir} ${sbindir} ${datadir}/*"
+INSANE_SKIP:${PN} += "dev-so \
+                      already-stripped \
+                     "
+

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb

Quoted 10 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +10 -0
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+ALLOW_EMPTY:${PN} = "1"
+
+FILES:${PN} += "${libdir} /home/root/*"
+
+inherit siteinfo unsupportarch
+python __anonymous() {
+    if d.getVar("SITEINFO_ENDIANNESS") == 'be':
+        msg =  "\nIt failed to use pre-build model to do

predict/inference on big-endian platform"

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 153

Quoted 1 line
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +1 -0
+        msg += "\n(such as qemumips), since upstream does not support

big-endian very well."

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb line 154

Quoted 1 line
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +1 -0
+        msg += "\nDetails:

https://github.com/tensorflow/tensorflow/issues/16364"

Quoted 8 lines
recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb new file +2 -1
+        bb.warn(msg)
+}
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#55634):

https://lists.yoctoproject.org/g/yocto/message/55634

Quoted 3 lines

Mute This Topic: https://lists.yoctoproject.org/mt/87873857/3616765
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
# Randy MacLeod
# Wind River Linux

#5 lore raw

Re: [yocto] [meta-tensorflow][PATCH 3/3] tensorflow-lite: add recipe

On 1/14/22 18:19, Julien Stephan wrote:
[Please note: This e-mail is from an EXTERNAL e-mail address] Hi Hongxu

Did you have a chance to take a look at it?

Sorry for replying late, thanks for your contribution, merged

//Hongxu

Best
Julien

Le ven. 24 déc. 2021 à 19:48, Randy MacLeod <[email protected]<mailto:[email protected]>> a écrit :
Thanks Stephan.

Hongxu, did you miss this?

../Randy

Quoted 180 lines · Julien STEPHAN

Adding 2.6.1 tensorflow-lite recipe.
This recipe is directly based on the corresponding 2.6.1 tensorflow recipe.

It has been build tested with latest honister and tested on several mediatek soc using benchmark_model and label_image (C++ and python)

---
  .../tensorflow/tensorflow-lite_2.6.1.bb<https://urldefense.com/v3/__http://tensorflow-lite_2.6.1.bb__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnaoV9UJIs$>       | 156 ++++++++++++++++++
  1 file changed, 156 insertions(+)

create mode 100644 recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb<https://urldefense.com/v3/__http://tensorflow-lite_2.6.1.bb__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnaoV9UJIs$>

recipes-framework/tensorflow/tensorflow-lite_2.6.1.bb<https://urldefense.com/v3/__http://tensorflow-lite_2.6.1.bb__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnaoV9UJIs$> new file +156 -1
new file mode 100644
index 0000000..104e5a3
@@ -0,0 +1,156 @@
+include tensorflow.inc
+
+SRC_URI += " \
+           file://0001-add-yocto-toolchain-to-support-cross-compiling.patch \
+           file://0001-fix-build-tensorflow-lite-examples-label_image-label.patch \
+           file://0001-label_image-tweak-default-model-location.patch \
+           file://0001-label_image.lite-tweak-default-model-location.patch \
+           file://0001-CheckFeatureOrDie-use-warning-to-avoid-die.patch \
+           file://0001-support-32-bit-x64-and-arm-for-yocto.patch \
+           file://0001-Revert-set-distinct_host_configuration-false-by-defa.patch \
+           file://0001-fix-default-Bazel-toolchain-not-work.patch \
+           file://0001-distutils-is-deprecated-in-Python-3.10-cross.patch \
+           file://BUILD.in \
+           file://BUILD.yocto_compiler \
+           file://cc_config.bzl.tpl \
+           file://yocto_compiler_configure.bzl \
+          "
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz;name=model-inv3<https://urldefense.com/v3/__https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz;name=model-inv3__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnasT5egS_$>"
+SRC_URI[model-inv3.md5sum] = "a904ddf15593d03c7dd786d552e22d73"
+SRC_URI[model-inv3.sha256sum] = "7045b72a954af4dce36346f478610acdccbf149168fa25c78e54e32f0c723d6d"
+
+SRC_URI += "https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_1.0_224_quant_and_labels.zip;name=model-mobv1<https://urldefense.com/v3/__https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_1.0_224_quant_and_labels.zip;name=model-mobv1__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnahpbuVO2$>"
+SRC_URI[model-mobv1.md5sum] = "38ac0c626947875bd311ef96c8baab62"
+SRC_URI[model-mobv1.sha256sum] = "2f8054076cf655e1a73778a49bd8fd0306d32b290b7e576dda9574f00f186c0f"
+
+RDEPENDS:${PN} += " \
+    python3 \
+    python3-core \
+    python3-numpy \
+"
+
+export PYTHON_BIN_PATH="${PYTHON}"
+export PYTHON_LIB_PATH="${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages"
+
+export CROSSTOOL_PYTHON_INCLUDE_PATH="${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}"
+
+do_configure:append () {
+    if [ ! -e ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h ];then
+        mv ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-target.h
+    fi
+
+    install -m 644 ${STAGING_INCDIR_NATIVE}/python${PYTHON_BASEVERSION}${PYTHON_ABI}/pyconfig.h \
+       ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig-native.h
+
+    cat > ${CROSSTOOL_PYTHON_INCLUDE_PATH}/pyconfig.h <<ENDOF
+#if defined (_PYTHON_INCLUDE_TARGET)
+#include "pyconfig-target.h"
+#elif defined (_PYTHON_INCLUDE_NATIVE)
+#include "pyconfig-native.h"
+#else
+#error "_PYTHON_INCLUDE_TARGET or _PYTHON_INCLUDE_NATIVE is not defined"
+#endif // End of #if defined (_PYTHON_INCLUDE_TARGET)
+
+ENDOF
+
+    mkdir -p ${S}/third_party/toolchains/yocto/
+    sed "s#%%CPU%%#${BAZEL_TARGET_CPU}#g" ${WORKDIR}/BUILD.in  > ${S}/third_party/toolchains/yocto/BUILD
+    chmod 644 ${S}/third_party/toolchains/yocto/BUILD
+    install -m 644 ${WORKDIR}/cc_config.bzl.tpl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/yocto_compiler_configure.bzl ${S}/third_party/toolchains/yocto/
+    install -m 644 ${WORKDIR}/BUILD.yocto_compiler ${S}
+
+    CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    SED_COMMAND="s#%%CT_NAME%%#${CT_NAME}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%WORKDIR%%#${WORKDIR}#g"
+    SED_COMMAND="${SED_COMMAND}; s#%%YOCTO_COMPILER_PATH%%#${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler#g"
+
+    sed -i "${SED_COMMAND}" ${S}/BUILD.yocto_compiler \
+                            ${S}/WORKSPACE
+
+    ${TF_CONFIG} \
+    ./configure
+}
+
+TF_TARGET_EXTRA ??= ""
+
+export CUSTOM_BAZEL_FLAGS = " \
+    ${TF_ARGS_EXTRA} \
+    --jobs=auto \
+    -c opt \
+    --cpu=${BAZEL_TARGET_CPU} \
+    --crosstool_top=@local_config_yocto_compiler//:toolchain \
+    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
+"
+
+do_compile () {
+    export CT_NAME=$(echo ${HOST_PREFIX} | rev | cut -c 2- | rev)
+    unset CC
+
+    ${BAZEL} build \
+        ${CUSTOM_BAZEL_FLAGS} \
+        --copt -DTF_LITE_DISABLE_X86_NEON --copt -DMESA_EGL_NO_X11_HEADERS \
+        tensorflow/lite:libtensorflowlite.so \
+        tensorflow/lite/tools/benchmark:benchmark_model \
+        //tensorflow/lite/examples/label_image:label_image \
+        ${TF_TARGET_EXTRA}
+
+    # build pip package
+    ${S}/tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh<https://urldefense.com/v3/__http://build_pip_package_with_bazel.sh__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnau8ozYeY$>
+
+}
+
+do_install() {
+    install -d ${D}${libdir}
+    install -m 644 ${S}/bazel-bin/tensorflow/lite/libtensorflowlite.so<https://urldefense.com/v3/__http://libtensorflowlite.so__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnatMEYuz0$> \
+        ${D}${libdir}
+
+    install -d ${D}${sbindir}
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model \
+        ${D}${sbindir}
+
+    install -m 755 ${S}/bazel-bin/tensorflow/lite/examples/label_image/label_image \
+        ${D}${sbindir}/label_image
+
+    install -d ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/imagenet_slim_labels.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/inception_v3_2016_08_28_frozen.pb \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/examples/label_image/data/grace_hopper.jpg \
+        ${D}${datadir}/label_image
+
+    install -m 644 ${WORKDIR}/labels_mobilenet_quant_v1_224.txt ${D}${datadir}/label_image
+    install -m 644 ${WORKDIR}/mobilenet_v1_1.0_224_quant.tflite \
+        ${D}${datadir}/label_image
+    install -m 644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \
+        ${D}${datadir}/label_image
+
+
+    #echo "Installing pip package"
+    install -d ${D}/${PYTHON_SITEPACKAGES_DIR}
+    ${STAGING_BINDIR_NATIVE}/pip3 install --disable-pip-version-check -v \
+        -t ${D}/${PYTHON_SITEPACKAGES_DIR} --no-cache-dir --no-deps \
+        ${S}/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-${PV}-*.whl
+
+}
+
+FILES:${PN} += "${libdir} ${sbindir} ${datadir}/*"
+INSANE_SKIP:${PN} += "dev-so \
+                      already-stripped \
+                     "
+
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+ALLOW_EMPTY:${PN} = "1"
+
+FILES:${PN} += "${libdir} /home/root/*"
+
+inherit siteinfo unsupportarch
+python __anonymous() {
+    if d.getVar("SITEINFO_ENDIANNESS") == 'be':
+        msg =  "\nIt failed to use pre-build model to do predict/inference on big-endian platform"
+        msg += "\n(such as qemumips), since upstream does not support big-endian very well."
+        msg += "\nDetails: https://github.com/tensorflow/tensorflow/issues/16364<https://urldefense.com/v3/__https://github.com/tensorflow/tensorflow/issues/16364__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnalR6VAA5$>"
+        bb.warn(msg)
+}
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 7 lines

Links: You receive all messages sent to this group.
View/Reply Online (#55634): https://lists.yoctoproject.org/g/yocto/message/55634<https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto/message/55634__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnai4psPZ7$>
Mute This Topic: https://lists.yoctoproject.org/mt/87873857/3616765<https://urldefense.com/v3/__https://lists.yoctoproject.org/mt/87873857/3616765__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnamvPFhzF$>
Group Owner: [email protected]<mailto:yocto%[email protected]>
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub<https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto/unsub__;!!AjveYdw8EvQ!OefygVvkNPmaP3BVhhQxru8NW9j-GvUBIhd_NjvaFiUyqWtLct0UIc5WUzHnahyGNgKZ$> [[email protected]<mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-

--
# Randy MacLeod
# Wind River Linux